<script>on mouseUp--answer "This demo will not report errorsΓÇöyou're on your own."ask "Enter all the arguments you want to use. (e.g. 15,0,0,,,1984)"if the result is "Cancel" then exit mouseupput it into args--domenu "message"put the blindtyping into myblindset the blindtyping to truetype "SetTimeDate" && args & returnput the result into myresset the blindtyping to myblindupdatetimeif word 1 of myres is "Error" thenbeepanswer myreselseanswer "Done!"end ifend mouseUp</script>
</part>
<part>
<id>5</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>170</left>
<top>306</top>
<right>273</right>
<bottom>329</bottom>
</rect>
<style>transparent</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name></name>
<script>on mouseUpset the scroll of cd fld "source" to 0show cd fld "source"end mouseUp</script>
<script>on mouseUpvisual wipe leftgo next cdend mouseUp</script>
</part>
<part>
<id>8</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>435</left>
<top>313</top>
<right>458</right>
<bottom>335</bottom>
</rect>
<style>transparent</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>1012</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name></name>
<script>on mouseUpvisual iris closego first cdend mouseUp</script>
</part>
<part>
<id>9</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <true /> </lockText>
<rect>
<left>14</left>
<top>239</top>
<right>217</right>
<bottom>275</bottom>
</rect>
<style>shadow</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Palatino</font>
<textSize>14</textSize>
<textStyle>plain</textStyle>
<textHeight>18</textHeight>
<name>clock</name>
<script></script>
</part>
<part>
<id>1</id>
<type>field</type>
<visible> <false /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <true /> </lockText>
<rect>
<left>6</left>
<top>26</top>
<right>504</right>
<bottom>334</bottom>
</rect>
<style>scrolling</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>9</textSize>
<textStyle>plain</textStyle>
<textHeight>12</textHeight>
<name>source</name>
<script>on mousedownhide meend mousedown</script>
</part>
<content>
<layer>card</layer>
<id>2</id>
<text><span class="style5">etTimeDate XCMD</span><span class="style1">This XCMD set the date and time of the Macintosh's clock. It is analagous to the ToolBox routine, SetDateTime.Form:</span><span class="style11">SetTimeDate hour,minute,second,month,day,year</span><span class="style1"> All arguments are optional. Arguments left empty are unchanged.Examples:</span><span class="style11">SetTimeDate ,,,1,15,1991</span><span class="style1"> This sets the date to January 15, 1991 and leaves the time of day unchanged.</span><span class="style11">SetTimeDate 15,0,0</span><span class="style1"> This sets the time to 3:00:00 PM</span></text>
</content>
<content>
<layer>card</layer>
<id>3</id>
<text><span class="style3">ote:The hour should be specified in 24 hour format. Invalid integer arguments and arguments out of range return errors.</span></text>
</content>
<content>
<layer>card</layer>
<id>9</id>
<text>Friday, February 1, 19916:58:50 PM</text>
</content>
<content>
<layer>card</layer>
<id>1</id>
<text>{ Name: SetTimeDate }{ This XCMD set the date and time of the Macintosh's clock. It is analagous to the ToolBox }{ routine, SetDateTime. }{ }{ By : Len Saaf }{ January, 1991 }{ ©1991 Raleigh Associates }{ Free for non-commercial use }{ Developed with THINK Pascal 3.0, ©1990 SYMANTEC Corp. }{ }{ Form: SetTimeDate hour,minute,second,month,day,year }{ All arguments are optional. Arguments left blank are unchanged. }{ }{ Example: SetTimeDate ,,,1,15,1991 }{ This sets the date to January 15, 1991 and leaves the time of day unchanged. }{ SetTimeDate 15,0,0 }{ This sets the time to 3:00:00 PM }{ }{ Note: }{ The hour should be specified in 24 hour format. }{ Invalid integer arguments and arguments out of range return an error. }{ }{ Include the following files in the project: }{ DRVRRuntime.lib }{ Interface.lib }{ SANE.p }{ SANELib.lib }{ HyperXCmd.p }{ HyperXLib.o }{ SetTimeDate.p }unit DummyUnit;interface uses HyperXCmd, SANE; procedure Main (paramPtr: XCmdPtr);implementation procedure Main (paramPtr: XCmdPtr); const Version = 'SetTimeDate XCMD 1.0 ©Raleigh Associates 1991 - Sets the date and time of the clock'; Usage = 'Usage: SetTimeDate hour, minute, second, month, day, year All arguments optional.'; MinArgs = 1; MaxArgs = 6; var str: str255; procedure CleanUpAndExit; begin{ nothing to clean up } exit(Main); end; { CleanUpAndExit } procedure Error (paramPtr: XCmdPtr; errStr: str255); begin errStr := concat('Error from SetTimeDate : ', errStr); paramPtr^.returnValue := PasToZero(paramPtr, errStr); CleanUpAndExit; end; { Error } function ReadInteger (paramPtr: XCmdPtr; paramNo: integer; var myInt: integer): Boolean;{ Reads a specified parameter and validates it using SANE routines } var d: Decimal; validPrefix: Boolean; myExt: extended; index: integer; begin if (paramNo > paramPtr^.paramCount) or (paramNo < 1) then ReadInteger := False else begin index := 0; CStr2Dec(CStrPtr(paramPtr^.params[paramNo]^), index, d, validPrefix); if not validPrefix then ReadInteger := False else begin myExt := Dec2Num(d); case ClassComp(myExt) of ZeroNum, NormalNum: if (abs(myExt) < maxint) then begin myInt := round(myExt); ReadInteger := True; end else ReadInteger := False; otherwise ReadInteger := False; end; { case } end; { if } end; { if } end; { ReadInteger } procedure InitProc (paramPtr: XCmdPtr); { } var str: str255; begin paramPtr^.returnValue := nil; paramPtr^.passflag := FALSE; if paramPtr^.paramCount = 1 then begin ZeroToPas(paramPtr, paramPtr^.params[1]^, str); if (str = '!') or (str = '?') then begin if str = '!' then paramPtr^.returnValue := PasToZero(paramPtr, Version) else paramPtr^.returnValue := PasToZero(paramPtr, Usage); CleanUpAndExit; end; { if } end; { if } if (paramPtr^.paramCount < MinArgs) or (paramPtr^.paramCount > MaxArgs) then Error(paramPtr, concat('Wrong number of arguments. ', Usage)); end; { InitProc } procedure ReturnProc (paramPtr: XCmdPtr); { puts the values into returnValue } begin{ Nothing to return } CleanUpAndExit; end; { ReturnProc } procedure SetTimeDate (paramPtr: XCmdPtr); var tHour, tMinute, tSecond, tMonth, tDay, tYear, mySecs: Longint; myDateTime: DateTimeRec; err: OSErr; str: str255; arg, pCount: integer; begin{ Get the time and make a copy of the elements } GetDateTime(mySecs); Secs2Date(mySecs, myDateTime); with myDateTime do begin tHour := hour; tMinute := minute; tSecond := second; tMonth := month; tDay := day; tYear := year; end; { with }{ read and check the arguments } pCount := paramPtr^.paramCount; ZeroToPas(paramPtr, paramPtr^.params[1]^, str); if length(str) > 0 then { ignore if the argument is empty } if ReadInteger(paramPtr, 1, arg) then if (arg >= 0) and (arg <= 23) then tHour := arg else Error(paramPtr, 'Hour out of range') else Error(paramPtr, 'Invalid hour'); if pCount >= 2 then begin ZeroToPas(paramPtr, paramPtr^.params[2]^, str); if length(str) > 0 then if ReadInteger(paramPtr, 2, arg) then if (arg >= 0) and (arg <= 59) then tMinute := arg else Error(paramPtr, 'Minute out of range') else Error(paramPtr, 'Invalid minute'); end; { if } if pCount >= 3 then begin ZeroToPas(paramPtr, paramPtr^.params[3]^, str); if length(str) > 0 then if ReadInteger(paramPtr, 3, arg) then if (arg >= 0) and (arg <= 59) then tSecond := arg else Error(paramPtr, 'Second out of range') else Error(paramPtr, 'Invalid second'); end; { if } if pCount >= 4 then begin ZeroToPas(paramPtr, paramPtr^.params[4]^, str); if length(str) > 0 then if ReadInteger(paramPtr, 4, arg) then if (arg >= 1) and (arg <= 12) then tMonth := arg else Error(paramPtr, 'Month out of range') else Error(paramPtr, 'Invalid month'); end; { if } if pCount >= 5 then begin ZeroToPas(paramPtr, paramPtr^.params[5]^, str); if length(str) > 0 then if ReadInteger(paramPtr, 5, arg) then if (arg >= 1) and (arg <= 31) then tDay := arg else Error(paramPtr, 'Day out of range') else Error(paramPtr, 'Invalid day'); end; { if } if pCount = 6 then begin ZeroToPas(paramPtr, paramPtr^.params[6]^, str); if length(str) > 0 then if ReadInteger(paramPtr, 6, arg) then if (arg >= 1904) and (arg <= 2040) then tYear := arg else Error(paramPtr, 'Year out of range') else Error(paramPtr, 'Invalid year'); end; { if }{ write back all elements } with myDateTime do begin hour := tHour; minute := tMinute; second := tSecond; month := tMonth; day := tDay; year := tYear; end; { with } Date2Secs(myDateTime, mySecs); err := SetDateTime(mySecs); if err <> noErr then Error(paramPtr, 'SetDateTime (Toolbox) returned error'); end; { SetTimeDate } begin { Main } InitProc(paramPtr); SetTimeDate(paramPtr); ReturnProc(paramPtr); end; { Main }end. { implementation }</text>
</content>
<name>settimedate</name>
<script>on idleupdatetimepass idleend idleon updatetimeput the selectedchunk into mychunkput the long date & return & the long time into cd fld "clock"select mychunkend updatetime</script>
</card>
card_4422.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
<script>on mouseUpask "Enter your latitude: (negative for south)"if the result is "Cancel" then exit mouseUpput it into latask "Enter your longitude: (negative for west)"if the result is "Cancel" then exit mouseupput it into lonask "Enter your time zone difference from UTC: (-5 for EST)"if the result is "Cancel" then exit mouseupput it into tzSetLocale lat,lon,tzput the result into myresif word 1 of myres is "Error" thenbeepanswer myreselseanswer "Done!"end ifend mouseUp</script>
</part>
<part>
<id>5</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>170</left>
<top>306</top>
<right>273</right>
<bottom>329</bottom>
</rect>
<style>transparent</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name></name>
<script>on mouseUpset the scroll of cd fld "source" to 0show cd fld "source"end mouseUp</script>
<script>on mouseUpvisual wipe leftgo next cdend mouseUp</script>
</part>
<part>
<id>8</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>435</left>
<top>313</top>
<right>458</right>
<bottom>335</bottom>
</rect>
<style>transparent</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>1012</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name></name>
<script>on mouseUpvisual iris closego first cdend mouseUp</script>
</part>
<part>
<id>1</id>
<type>field</type>
<visible> <false /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <true /> </lockText>
<rect>
<left>6</left>
<top>26</top>
<right>504</right>
<bottom>334</bottom>
</rect>
<style>scrolling</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>9</textSize>
<textStyle>plain</textStyle>
<textHeight>12</textHeight>
<name>source</name>
<script>on mousedownhide meend mousedown</script>
</part>
<content>
<layer>card</layer>
<id>1</id>
<text>{ Name: SetLocale}{ This XCMD set location information that is stored in the Macintosh's}{ parameter RAM. This information is normally set using the Map cdev}{ (a part of Apple system software). The location information can be}{ read with the GetLocale XCMD that accompanies this XCMD.}{}{ By : Len Saaf}{ January, 1991}{ ©1991 Raleigh Associates}{ Free for non-commercial use}{ Developed with THINK Pascal 3.0, ©1990 SYMANTEC Corp.}{}{ Form: SetLocale latitude,longitude,UTCdifference,DSTdifference}{ The first word of the result is "Error" if an error has occurred.}{ 1) Latitude is in degrees (positive for north, negative for south)}{ 2) Longitude is in degrees (positive for east, negative for west)}{ 3) Difference from UTC (aka GMT) in hours}{ 4) A daylight savings time difference (undocumented as far as I can tell)}{}{ Example: SetLocale 43.25, -77.5, -5, 0}{ This sets the location to 43.25° N, 77.5° W}{ The UTC difference is set to -5 (EST)}{}{ Note:}{ Latitude & longitude should be in decimal form, not in degrees, minutes,}{ and seconds—likewise with the UTC difference in hours.}{}{ Include the following files in the project:}{ DRVRRuntime.lib}{ Interface.lib}{ SANE.p}{ SANElib.lib}{ FixMath.p}{ Script.p}{ HyperXCmd.p}{ HyperXLib.o}{ SetLocale.p}unit DummyUnit;interface uses HyperXCmd, FixMath, Script, SANE; procedure Main (paramPtr: XCmdPtr);implementation procedure Main (paramPtr: XCmdPtr); const Version = 'SetLocale XCMD 1.0 ©Raleigh Associates 1991 - Sets location info in PRAM'; Usage = 'Usage: SetLocale latitude, longitude, <UTCdifference, <DSTdifference>>'; MinArgs = 2; MaxArgs = 4; procedure CleanUpAndExit; begin{ nothing to clean up } exit(Main); end; { CleanUpAndExit } procedure Error (paramPtr: XCmdPtr; errStr: str255); begin errStr := concat('Error from SetLocale : ', errStr); paramPtr^.returnValue := PasToZero(paramPtr, errStr); CleanUpAndExit; end; { Error } function ReadReal (paramPtr: XCmdPtr; paramNo: integer; var myReal: real): Boolean;{ Reads in a specified parameter and validates it using SANE routines } const maxreal = 3.4e38; var d: Decimal; validPrefix: Boolean; index: integer; myExt: extended; begin if (paramNo > paramPtr^.paramCount) or (paramNo < 1) then ReadReal := False else begin index := 0; CStr2Dec(CStrPtr(paramPtr^.params[paramNo]^), index, d, validPrefix); if not validPrefix then ReadReal := False else begin myExt := Dec2Num(d); case ClassExtended(myExt) of ZeroNum, NormalNum: if (abs(myExt) < maxreal) then begin myReal := myExt; ReadReal := True; end else ReadReal := False; otherwise ReadReal := False; end; { case } end; { if } end; { if } end; { ReadReal } procedure InitProc (paramPtr: XCmdPtr); { } var str: str255; begin paramPtr^.returnValue := nil; paramPtr^.passflag := FALSE; if paramPtr^.paramCount = 1 then begin ZeroToPas(paramPtr, paramPtr^.params[1]^, str); if (str = '!') or (str = '?') then begin if str = '!' then paramPtr^.returnValue := PasToZero(paramPtr, Version) else paramPtr^.returnValue := PasToZero(paramPtr, Usage); CleanUpAndExit; end; { if } end; { if } if (paramPtr^.paramCount < MinArgs) or (paramPtr^.paramCount > MaxArgs) then Error(paramPtr, concat('Wrong number of arguments. ', Usage)); end; { InitProc } procedure ReturnProc (paramPtr: XCmdPtr); { puts the values into returnValue } begin{ Nothing to return } CleanUpAndExit; end; { ReturnProc } procedure SetLocale (paramPtr: XCmdPtr); var lat, lon, utcDiff, dlsDiff: real; myLocale: MachineLocation; tUTC: longint; tDLS: SignedByte; str: str255; pCount: integer; begin{ read and check the arguments } pCount := paramPtr^.paramCount; if ReadReal(paramPtr, 1, lat) then if (lat >= -90) and (lat <= 90) then else Error(paramPtr, 'Latitude out of range') else Error(paramPtr, 'Invalid latitude'); if pCount >= 2 then begin if ReadReal(paramPtr, 2, lon) then if (lon >= -180) and (lon <= 180) then else Error(paramPtr, 'Longitude out of range') else Error(paramPtr, 'Invalid longitude'); end; { if } if pCount >= 3 then begin if ReadReal(paramPtr, 3, utcDiff) then if (utcDiff > -24) and (utcDiff < 24) then else Error(paramPtr, 'UTC difference out of range') else Error(paramPtr, 'Invalid UTC difference'); end; { if } if pCount = 4 then begin if ReadReal(paramPtr, 4, dlsDiff) then if (dlsDiff >= -127) and (dlsDiff < 128) then else Error(paramPtr, 'DLS difference out of range') else Error(paramPtr, 'Invalid DLS difference'); end; { if } ReadLocation(myLocale); { Script Manager routine to get the info from PRAM } myLocale.latitude := X2Frac(lat / 90); myLocale.longitude := X2Frac(lon / 90); if paramPtr^.paramCount >= 3 then begin tDLS := myLocale.dlsDelta; tUTC := round(utcDiff * 3600); if pCount >= 4 then tDLS := round(dlsDiff); myLocale.gmtDelta := tUTC; myLocale.dlsDelta := tDLS; end; { if } WriteLocation(myLocale); { Script Manager routine to write the info to PRAM } end; { SetLocale } begin { Main } InitProc(paramPtr); SetLocale(paramPtr); ReturnProc(paramPtr); end; { Main }end. { implementation }</text>
</content>
<content>
<layer>card</layer>
<id>2</id>
<text><span class="style5">etLocale XCMD</span><span class="style1">This XCMD sets the location information that is stored in the Macintosh's parameter RAM. This information is normally set using the Map cdev (a part of Apple system software). The location information can be read with the GetLocale XCMD included in this stack. Form: </span><span class="style11">SetLocale latitude,longitude<,UTCdifference<,DSTdifference>></span><span class="style1">The last two arguments are optional. The arguments in detail: 1) Latitude in degrees (positive for north, negative for south) 2) Longitude in degrees (positive for east, negative for west) 3) Difference from UTC (aka GMT) in hours 4) A daylight savings time difference (undocumented as far as I can tell)If the first word of the result is "Error" if an error has occurred.Example: </span><span class="style11">SetLocale 43.25,-77.5,-5</span><span class="style1">This sets the location to 43.25┬░ N, 77.5┬░ WThe UTC difference is set to -5 (EST)</span></text>
</content>
<content>
<layer>card</layer>
<id>3</id>
<text><span class="style3">ote:Latitude & longitude should be in decimal form, not in degrees, minutes, and secondsΓÇölikewise with the UTC difference in hours.</span></text>
</content>
<name>setlocale</name>
<script></script>
</card>
card_3597.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
<script>on mouseUpGetLocaleput the result into myresif word 1 of myres is "Error" thenbeepput return &¬"Error returned" & return & return & "XCMD returned:" ¬&& myres into tmpelseput return & "XCMD returned:" && myres & return & return into tmpput "Latitude:" && abs(item 1 of myres) after tmpif (item 1 of myres) < 0 thenput " South" after tmpelseput " North" after tmpend ifput return & "Longitude:" && abs(item 2 of myres) after tmpif (item 2 of myres) < 0 thenput " West" after tmpelseput " East" after tmpend ifput return & return after tmpif (item 3 of myres) < 0 thenput abs(item 3 of myres) && "hours behind UTC" after tmpelseput abs(item 3 of myres) && "hours ahead of UTC" after tmpend ifend ifput return & return & "Click to hide." after tmpput tmp into cd fld "results"show cd fld "results"end mouseUp</script>
</part>
<part>
<id>5</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>170</left>
<top>306</top>
<right>273</right>
<bottom>329</bottom>
</rect>
<style>transparent</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name></name>
<script>on mouseUpset the scroll of cd fld "source" to 0show cd fld "source"end mouseUp</script>
<script>on mouseUpvisual wipe leftgo next cdend mouseUp</script>
</part>
<part>
<id>8</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>435</left>
<top>313</top>
<right>458</right>
<bottom>335</bottom>
</rect>
<style>transparent</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>1012</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name></name>
<script>on mouseUpvisual iris closego first cdend mouseUp</script>
</part>
<part>
<id>1</id>
<type>field</type>
<visible> <false /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <true /> </lockText>
<rect>
<left>6</left>
<top>26</top>
<right>504</right>
<bottom>334</bottom>
</rect>
<style>scrolling</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>9</textSize>
<textStyle>plain</textStyle>
<textHeight>12</textHeight>
<name>source</name>
<script>on mousedownhide meend mousedown</script>
</part>
<part>
<id>9</id>
<type>field</type>
<visible> <false /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <true /> </lockText>
<rect>
<left>102</left>
<top>71</top>
<right>423</right>
<bottom>257</bottom>
</rect>
<style>shadow</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Palatino</font>
<textSize>14</textSize>
<textStyle>plain</textStyle>
<textHeight>18</textHeight>
<name>results</name>
<script>on mousedownhide meend mousedown</script>
</part>
<content>
<layer>card</layer>
<id>1</id>
<text>{ Name: GetLocale}{ This XCMD fetches location information that is stored in the Macintosh's}{ parameter RAM. This information can be set using the Map cdev}{ (a part of Apple system software) or by the SetLocale XCMD}{ that accopanies this XCMD.}{}{ Written by : Len Saaf}{ January, 1991}{ ©1991 Raleigh Associates}{ Free for non-commercial use}{ Developed with THINK Pascal 3.0, ©1990 SYMANTEC Corp.}{}{ Form: GetLocale}{ The first word of the result is "Error" if an error has occurred.}{ Otherwise, the result is a four-item container:}{ 1) Latitude in degrees (positive for north, negative for south)}{ 2) Longitude in degrees (positive for east, negative for west)}{ 3) Difference from UTC (aka GMT) in hours}{ 4) A daylight savings time difference (undocumented as far as I can tell)}{}{ Example: GetLocale}{ put the result into myLoc}{ put item 1 of myLoc into myLatitude}{ put item 2 of myLoc into myLongitude}{}{ Note:}{ Latitude & longitude are returned in decimal form, not in degrees, minutes,}{ and seconds—likewise with the UTC difference in hours.}{}{ Include the following files in the project:}{ DRVRRuntime.lib}{ Interface.lib}{ SANElib.lib}{ FixMath.p}{ Script.p}{ HyperXCmd.p}{ HyperXLib.o}{ GetLocale.p}unit DummyUnit;interface uses HyperXCmd, FixMath, Script; procedure Main (paramPtr: XCmdPtr);implementation procedure Main (paramPtr: XCmdPtr); const Version = 'GetLocale XCMD 1.0 ©Raleigh Associates 1991 - Gets location info from PRAM'; Usage = 'Usage: No arguments. Returns: Latitude, Longitude, UTCdifference, DaylightSavingsDifference'; MinArgs = 0; MaxArgs = 0; var lat, lon, utcDiff, dlsDiff: real; procedure CleanUpAndExit; begin{ nothing to clean up } exit(Main); end; { CleanUpAndExit } procedure Error (paramPtr: XCmdPtr; errStr: str255); begin errStr := concat('Error from GetLocale : ', errStr); paramPtr^.returnValue := PasToZero(paramPtr, errStr); CleanUpAndExit; end; { Error } procedure InitProc (paramPtr: XCmdPtr); { } var str: str255; begin paramPtr^.returnValue := nil; paramPtr^.passflag := FALSE; if paramPtr^.paramCount = 1 then begin ZeroToPas(paramPtr, paramPtr^.params[1]^, str); if (str = '!') or (str = '?') then begin if str = '!' then paramPtr^.returnValue := PasToZero(paramPtr, Version) else paramPtr^.returnValue := PasToZero(paramPtr, Usage); CleanUpAndExit; end; { if } end; { if } if (paramPtr^.paramCount < MinArgs) or (paramPtr^.paramCount > MaxArgs) then Error(paramPtr, concat('Wrong number of arguments. ', Usage)); end; { InitProc } procedure ReturnProc (paramPtr: XCmdPtr); { puts the values into returnValue } var str1, str2, str3, str4: str255; begin ExtToStr(paramPtr, lat, str1); ExtToStr(paramPtr, lon, str2); ExtToStr(paramPtr, utcDiff, str3); ExtToStr(paramPtr, dlsDiff, str4); str1 := concat(str1, ',', str2, ',', str3, ',', str4); if (lat = 0) and (lon = 0) and (utcDiff = 0) then { all are zero if the PRAM is empty or zapped } Error(paramPtr, 'Location information has not been set!') else paramPtr^.returnValue := PasToZero(paramPtr, str1); CleanUpAndExit; end; { ReturnProc } procedure GetLocale (paramPtr: XCmdPtr); var myLocale: MachineLocation; iutcdelta: longint; mybyte: SignedByte; begin ReadLocation(myLocale); { this is the Script Manager routine that extracts the data from the PRAM } lat := Frac2X(myLocale.latitude) * 90; lon := Frac2X(myLocale.longitude) * 90; iutcdelta := BAnd(myLocale.gmtDelta, $00FFFFFF); if BTst(iutcdelta, 23) then iutcdelta := BOr(iutcdelta, $FF000000); utcDiff := iutcdelta / 3600; mybyte := myLocale.dlsDelta; dlsDiff := mybyte; end; { GetLocale } begin { Main } InitProc(paramPtr); GetLocale(paramPtr); ReturnProc(paramPtr); end; { Main }end. { implementation }</text>
</content>
<content>
<layer>card</layer>
<id>2</id>
<text><span class="style5">etLocale XCMD</span><span class="style1">This XCMD fetches location information stored in the Macintosh's parameter RAM. This information can be set using the Map cdev (a part of Apple system software) or by the SetLocale XCMD included in this stack.</span><span class="style6"></span><span class="style1">Form: </span><span class="style11">GetLocale</span><span class="style1">The first word of the result is "Error" if an error has occurred.Otherwise, the result is a four-item container: 1) Latitude in degrees (positive for north, negative for south) 2) Longitude in degrees (positive for east, negative for west) 3) Difference from UTC (aka GMT) in hours 4) A daylight savings time difference (undocumented as far as I can tell)Example: </span><span class="style11">GetLocaleput the result into myLocput item 1 of myLoc into myLatitudeput item 2 of myLoc into myLongitude</span><span class="style1"></span></text>
</content>
<content>
<layer>card</layer>
<id>3</id>
<text>Notes: Latitude & longitude are returned in decimal form, not in degrees, minutes, and secondsΓÇölikewise with the UTC difference in hours.If the location has never been set, or if the PRAM has been zapped, the XCMD returns an error.</text>
<script>on mouseUpvisual wipe leftgo next cdend mouseUp</script>
</part>
<content>
<layer>card</layer>
<id>1</id>
<text><span class="style2">ocale Package 1.0</span><span class="style1"></span><span class="style4">by Len Saaf©1991 Raleigh AssociatesThese XCMDs are free for non-commercial purposes.</span><span class="style3">There are three Hypercard XCMDs in this stack. Two read and write the latititude, longitude and time zone information that is stored in the Macintosh's parameter RAM. The third XCMD will set the time and date of the Macintosh should you ever require that done from Hypercard. The Pascal source code is included. The XCMDs return desciption and usage information when called with "!" and "?" respectively.Feedback is welcome. My address is saaf@joker.optics.rochester.edu</span></text>